﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Threading;
using M7;

namespace C7
{
	/// <summary>
	/// Interaction logic for BaseWindow.xaml
	/// </summary>
    public partial class EditInfoWindow : UserControl
    {
        private WindowOperations WindowOPs = new WindowOperations();
        public EditInfoWindow()
        {
            this.InitializeComponent();
            WindowOPs.TextBoxesToHandlers(LayoutRoot);
            WindowOPs.WindowToAnimationHandlers(LayoutRoot, true);
        }

        private void spOKMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            NCustomer obj = new NCustomer();
            obj.Password = tbPassword.Password;
            obj.FirstName = tbFirstName.Text;
            obj.LastName = tbLastName.Text;
            obj.Mobile = tbMobile.Text;
            obj.CreditCardID = int.Parse(tbCreditCard.Text);
            obj.Address = tbAddress.Text;
            Thread thr = new Thread(delegate() { Customer.SignUp(ref obj); });
            thr.IsBackground = true;
            thr.Start();
        }

        private void EditInfoW_Loaded(object sender, RoutedEventArgs e)
        {
            NCustomer obj = new NCustomer();
            obj.CustomerID = Info.current.CustomerID;
            Thread thr = new Thread(delegate() { Customer.GetInfo(ref obj); });
            thr.IsBackground = true;
            thr.Start();
        }
    }
}